import React, {Component} from 'react';
import { NumberPicker, Context,Popup, Tab,Button,Group,Field } from 'saltui';

export default class Number extends React.Component {
  constructor(props) {
    super(props);
    let value = 0
    if(this.props.value){
       value = this.props.value;
    }
    this.state = {
      count: '2',
      a: value,
      onChange:this.props.onChange,
      id:this.props.id,
    };
  }

  handleChange(name, value) {
    const t = this;
    t.setState({
      [name]: value,
    });
    this.state.onChange(this.state.id,value);
  }
  render() {
    const t = this;
    return (
        <div> <NumberPicker value={t.state.a} max={1000} min={0} step={1} onChange={t.handleChange.bind(t, 'a')} useTouch={!Context.isPC} /></div>
    );
  }
}
